﻿namespace ChinaUnicom.Converters
{
    using Avatar.Themes;
    using System;
    using System.Globalization;
    using System.Windows;
    using System.Windows.Data;

    public class ThemeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var theme = (Theme)value;

            switch (theme)
            {
                case Theme.Light:
                    return "亮";
                case Theme.Dark:
                    return "暗";
                default:
                    return "系统";
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string strValue = value as string;

            switch (strValue)
            {
                case "亮":
                    return Theme.Light;
                case "暗":
                    return Theme.Dark;
                case "系统":
                    return Theme.System;
            }

            return DependencyProperty.UnsetValue;
        }
    }

}
